package net.apexes.demo.codegen.ormlite.column;

import net.apexes.commons.ormlite.Column;
import net.apexes.commons.ormlite.ForeignKey;
import net.apexes.commons.ormlite.Index;
import net.apexes.demo.codegen.ormlite.column.base.QEntityBase;
import net.apexes.demo.codegen.ormlite.entity.GoodsComboItemGroup;

/**
 * QGoodsComboItemGroup is a ORMLite query type for GoodsComboItemGroup
 * @see GoodsComboItemGroup
 */
public class QGoodsComboItemGroup extends QEntityBase<GoodsComboItemGroup> {

    public static final QGoodsComboItemGroup $ = new QGoodsComboItemGroup("GOODS_COMBO_ITEM_GROUP");

    public final Column name = field("name").columnName("NAME").varchar(32).notNull().build();

    public final Column goodsId = field("goodsId").columnName("GOODS_ID").varchar(22).notNull().build();

    public final Column minQty = field("minQty").columnName("MIN_QTY").decimal(12, 3).notNull().build();

    public final Column maxQty = field("maxQty").columnName("MAX_QTY").decimal(12, 3).build();

    public final Column seqOrder = field("seqOrder").columnName("SEQ_ORDER").integer().notNull().build();

    public final Column templateId = field("templateId").columnName("TEMPLATE_ID").varchar(22).notNull().build();

    public class Indexs {

        public final Index constraintIndexA9 = index("CONSTRAINT_INDEX_A9").column(goodsId).build();

        public final Index primaryKeyA96 = index("PRIMARY_KEY_A96").unique().column(id).build();

    }

    public final Indexs ix = new Indexs();

    public class ForeignKeys {

        public final ForeignKey constraintA965 = foreignKey(goodsId, "GOODS", "ID");

    }

    public final ForeignKeys fk = new ForeignKeys();

    public QGoodsComboItemGroup(String tableName) {
        super(GoodsComboItemGroup.class, tableName);
    }

    @Override
    public GoodsComboItemGroup newInstance() {
        return new GoodsComboItemGroup();
    }

    @Override
    public Object getFieldValue(GoodsComboItemGroup instance, String fieldName) {
        switch (fieldName) {
            case "name":
                return instance.getName();
            case "goodsId":
                return instance.getGoodsId();
            case "minQty":
                return instance.getMinQty();
            case "maxQty":
                return instance.getMaxQty();
            case "seqOrder":
                return instance.getSeqOrder();
            case "templateId":
                return instance.getTemplateId();
            default:
                return super.getFieldValue(instance, fieldName);
        }
    }

    @Override
    public void setupFieldValue(GoodsComboItemGroup instance, String fieldName, Object value) {
        switch (fieldName) {
            case "name":
                instance.setName((java.lang.String) value);
                break;
            case "goodsId":
                instance.setGoodsId((java.lang.String) value);
                break;
            case "minQty":
                instance.setMinQty((java.math.BigDecimal) value);
                break;
            case "maxQty":
                instance.setMaxQty((java.math.BigDecimal) value);
                break;
            case "seqOrder":
                instance.setSeqOrder((java.lang.Integer) value);
                break;
            case "templateId":
                instance.setTemplateId((java.lang.String) value);
                break;
            default:
                super.setupFieldValue(instance, fieldName, value);
                break;
        }
    }

}

